home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 43
/
Amiga Format CD43 (1999)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-09].iso
/
-serious-
/
comms
/
other
/
ascan
/
sources
/
ascan.h
< prev
next >
Wrap
C/C++ Source or Header
|
1999-06-14
|
4KB
|
149 lines
#include <proto/socket.h>
#include <proto/exec.h>
#include <proto/dos.h>
#include <exec/memory.h>
#include <sys/socket.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dos.h>
#include <signal.h>
/***************************************************************************/
#define MAXCHILDS 128 /*max number of ascan process that can be run*/
#define MAX_SOCKS_PER_TASK 256 /*max socket per ascan proc*/
#define LIMITED_SOCKETS 64 /*limited socks per cycle*/
/***************************************************************************/
/* ascan is NOT pure, put it is easy to make it pure, just put here
DOSBase and Socket and ...*/
struct global
{
struct Process *childs[MAXCHILDS];
ULONG flags;
int nchild;
int gt;
int ppt;
int from;
int to;
};
/*the startup messages each ascan proc gets*/
struct childMsg
{
struct Message link;
UBYTE name[35];
struct global *g;
ULONG tnum;
u_long host;
int from;
int to;
ULONG res;
ULONG code;
BPTR out;
};
#define FLG_VERBOSE 0x00000001
#define FLG_LIMITED 0x00000002
#define FLG_MIAMISOCKS (FLG_LIMITED|0x00000004) /* not used in this version */
#define FLG_PORTNAME 0x00000008
/***************************************************************************/
/* structure used for timing */
struct dstruct
{
int disinit;
struct MsgPort dport;
LONG sigBit;
struct timerequest dtr;
ULONG flags;
};
#define DSFLG_ALLOCATED 1
#define DSFLG_ACTIVE 2
/***************************************************************************/
/* defaults */
#define DEF_NCHILD 2
#define DEF_GT 0
#define DEF_CT 0
#define DEF_PPT 128
#define DEF_FROM 1
#define DEF_TO 80
/***************************************************************************/
/* errors */
enum
{
SCAN_ERROR_NOBSDSOCKET = -1000,
SCAN_ERROR_NOSOCKET,
SCAN_ERROR_NOMEM,
SCAN_ERROR_BUFFER,
SCAN_ERROR_TARGETNOTFOUND,
SCAN_ERROR_SENDING,
SCAN_ERROR_BREAK,
SCAN_ERROR_TIMER,
SCAN_ERROR_TIMEOUT,
SCAN_ERROR_SELECT,
};
/***************************************************************************/
/* some help macro */
#define NODE(a) ((struct Node *)(a))
#define MINNODE(a) ((struct MinNode *)(a))
#define LIST(a) ((struct List *)(a))
#define MINLIST(a) ((struct MinList *)(a))
#define MESSAGE(m) ((struct Message *)(m))
#define NEWLIST(l) (LIST(l)->lh_Head = NODE(&LIST(l)->lh_Tail), \
LIST(l)->lh_Tail = NULL, \
LIST(l)->lh_TailPred = NODE(&LIST(l)->lh_Head))
#define INITPORT(p,s) ((p)->mp_Flags = PA_SIGNAL, \
(p)->mp_SigBit = (UBYTE)(s), \
(p)->mp_SigTask = FindTask(NULL), \
NEWLIST(&((p)->mp_MsgList)))
#define INITMESSAGE(m,p,l) ((m)->mn_Node.ln_Type = NT_MESSAGE, \
(m)->mn_ReplyPort = (p), \
(m)->mn_Length = (l))
#ifndef SAVEDS
#define SAVEDS __saveds
#endif
#ifndef ASM
#define ASM __asm
#endif
#ifndef REG
#define REG(x) register __ ## x
#endif
/***************************************************************************/
/* utils.c */
u_long resolve ( STRPTR hostName );
/* errors.c */
void error ( int code , char *prg , char *string );
void printGlobal ( struct global *g , STRPTR host , u_long hostIP );
/* start.c */
void SAVEDS ascan ( void );
/* proc.c */
struct Process *createProc ( struct childMsg *msg );
/* ddelay.c */
LONG setDStruct ( struct dstruct *ds );
void freeDStruct ( struct dstruct *ds );
ULONG doDelay ( struct dstruct *ds , ULONG secs , ULONG micros , ULONG signals );
void startDelay ( struct dstruct *ds , ULONG secs , ULONG micros );
void stopDelay ( struct dstruct *ds );
/***************************************************************************/